<style itemscope>

    .layui-form-label.required:before { /* 这种写法也可以*/
        content: ' *';
        color: red;
    }

    .addProductionPlanForm-title .title, .examineProductionPlanForm-title .title {
        display: inline-block;
        margin: 20px;
        font-size: 16px;
        font-weight: bold;
        color: #333333;
        line-height: 19px;
        position: relative;
        padding: 6px 0 19px 0;
    }

    .addProductionPlanForm-title .title:after, .examineProductionPlanForm-title .title:after {
        content: '';
        display: block;
        position: absolute;
        left: 0;
        bottom: 0;
        width: calc(100% + 6px);
        height: 3px;
        background: #0A8B0A;
    }

    .open-form .layui-input-block{
        margin-left: 115px;
    }
</style>
<script type="text/javascript" src="../../../admin/assets/js/pdfobject.min.js"></script>
<!-- 表单弹窗 -->
<form lay-filter="taskInitQualityRecordForm" class="layui-form open-form">
    <div class="open-model">
        <div class="open-auto">
            <div class="examineProductionPlanForm-title">
                <h3 class="title">任务信息</h3>
            </div>
            <!-- 表单 -->
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">质检性质：</label>
                    <div class="layui-input-block">
                        <input id="qualityTestingNatureName" disabled name="qualityTestingNatureName" placeholder="质检类型" type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">质检类型：</label>
                    <div class="layui-input-block">
                        <input id="testingTypeName" disabled name="testingTypeName" placeholder="质检类型" type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">质检分类：</label>
                    <div class="layui-input-block">
                        <input id="testingCategoryName" disabled name="testingCategoryName" placeholder="质检分类"
                               type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">开工单：</label>
                    <div class="layui-input-block">
                        <input id="workOrderCode" disabled name="workOrderCode" placeholder="开工单" type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">所属计划：</label>
                    <div class="layui-input-block">
                        <input id="planCode" disabled name="planCode" placeholder="所属计划" type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">物料编码：</label>
                    <div class="layui-input-block">
                        <input id="skuCode" disabled name="skuCode" placeholder="物料编码" type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">物料名称：</label>
                    <div class="layui-input-block">
                        <input id="skuName" disabled name="skuName" placeholder="物料名称" type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">送检数量：</label>
                    <div class="layui-input-block">
                        <input id="submissionQuantity" disabled name="submissionQuantity" placeholder="请输入数量"
                               type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">送检工位：</label>
                    <div class="layui-input-block">
                        <input id="inspectDeviceCode" disabled name="inspectDeviceCode" placeholder="请输入送检工位" type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">载具编码：</label>
                    <div class="layui-input-block">
                        <input id="carrierCode" disabled name="carrierCode" placeholder="请输入载具编码" type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">送检备注：</label>
                    <div class="layui-input-block">
                        <input id="remark" disabled name="remark" placeholder="请输入备注" type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">状态：</label>
                    <div class="layui-input-block">
                        <input id="statusDescName" disabled style="border: none" name="statusDescName"
                               type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
            </div>
            <div class="examineProductionPlanForm-title">
                <h3 class="title">检测样品信息</h3>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">样品编码：</label>
                    <div class="layui-input-block">
                        <input id="sampleCode" disabled name="sampleCode" placeholder="样品编码" type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">报检人：</label>
                    <div class="layui-input-block">
                        <input id="modifierName" disabled name="modifierName" placeholder="报检人" type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>

                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">状态：</label>
                    <div class="layui-input-block">
                        <input id="statusName" disabled name="statusName" type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">送检工位：</label>
                    <div class="layui-input-block">
                        <input id="JCInspectDeviceCode" disabled name="JCInspectDeviceCode" placeholder="请输入送检工位"
                               type="text"
                               class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">

                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto required">判定结果：</label>
                    <div class="layui-input-block">
                        <input id="qualityTestingResult" name="qualityTestingResult" type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label w-auto">检测备注：</label>
                    <div class="layui-input-block">
                        <input id="JCRemark" name="JCRemark" disabled type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md12">
                    <table class="layui-table" id="addQualityItemTableList"
                           lay-filter="addQualityItemTableList" style="margin: 1px 0 10px;"></table>
                </div>
            </div>
        </div>
        <div class="layui-form-item text-right pd-20" style="padding-top: 10px !important;">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </div>
</form>

<script type="text/html" id="viewAttachmentHtml">
    <div id="example1" style="height: 100%;"></div>
</script>

<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table', 'laydate', 'admin', 'laytpl', 'upload', 'config'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var config = layui.config;
        var upload = layui.upload;
        var table = layui.table;
        var admin = layui.admin;
        var form = layui.form;

        let initData={};

        let addQualityItemTableList = [];

        //初始化详情信息
        let taskQualityDetailValueData = admin.getTempData("taskQualityDetailValueData");

        if (taskQualityDetailValueData) {

            $("#JCInspectDeviceCode").val(taskQualityDetailValueData.JCInspectDeviceCode);
            $("#JCRemark").val(taskQualityDetailValueData.JCRemark);
            $("#qualityTestingResult").val(taskQualityDetailValueData.qualityTestingResult);

            //初始化数据
            admin.reqSync('production/quality/admin/taskQualityRecord/getDetailRecordValue', {taskId: taskQualityDetailValueData.taskId,
                    recordDetailId:taskQualityDetailValueData.recordDetailId},
                res => {
                    if (res.code == 200) {
                        initData = res.data;
                        form.val("taskInitQualityRecordForm",initData);
                        $("#statusName").val(initData.statusDesc);
                        //初始化检测项目
                        addQualityItemTableList = res.data.detailValueInfoVos;
                        table.reload('addQualityItemTableList', {
                            data: addQualityItemTableList
                        });
                    }
                }, 'GET');

        }
        //config.getUser().username
        $("#modifierName").val(config.getUser().username);

        let addQualityDetailRecordTable = table.render({
            elem: '#addQualityItemTableList',
            data: addQualityItemTableList,
            id: 'addQualityItemTableList',
            limit: 9999,
            cols: [[
                {type: 'numbers', title: '序号', fixed: 'center'}
                , {field: 'processQualityName', title: '检测项目', fixed: 'center', width: 200}
                , {field: 'utensil', title: '检测器具', fixed: 'center'}
                , {field: 'way', title: '检验方法', fixed: 'center'}
                , {field: 'standard', title: '标准/规格', fixed: 'center'}
                , {field: 'processQualityValueName', title: '检测结果(必填)', fixed: 'center'}
                , {field: 'remark',title: '质检备注(选填)', fixed: 'center'}
                , {field: 'fileName', title: '照片(选填)', fixed: 'center'}
            ]]
        });
    });
</script>